-- spPaisSel null,'italia'
create procedure spPaisSel
  @Codigo int = null,
  @Nombre varchar (100) = null
with encryption
as
	declare @intError int
	begin transaction
	
	Select * from Pais 
		where Codigo = Isnull(@Codigo,Codigo)
			and Nombre = Isnull(@Nombre,Nombre)
			
    set @intError = @@Error
    if (@intError <> 0) goto onError
  
	commit transaction
	return @intError

onError:
  if @@TranCount > 0 rollback transaction
  return @intError
go